Generated by Cython 3.0.2
Yellow lines hint at Python interaction.
Click on a line that starts with a "+" to see the C code that Cython generated for it.
Raw output: interpolation_bilinear.c
+01: # cython: infer_types=True, wraparound=False, nonecheck=False, boundscheck=False, cdivision=True, language_level=3, profile=False, autogen_pxd=True
__pyx_t_7 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_7) < 0) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
02:
+03: import numpy as np
__pyx_t_7 = __Pyx_ImportDottedModule(__pyx_n_s_numpy, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 3, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_7) < 0) __PYX_ERR(1, 3, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
04: cimport numpy as np
05:
06:
+07: cdef float _interpolate(float[:,:] image, float x, float y) nogil:
static float __pyx_f_7nanopyx_4core_9transform_22interpolation_bilinear__interpolate(__Pyx_memviewslice __pyx_v_image, float __pyx_v_x, float __pyx_v_y) {
int __pyx_v_rows;
int __pyx_v_cols;
float __pyx_r;
/* … */
/* function exit code */
__pyx_L0:;
return __pyx_r;
}
08: """
09: Interpolate image using Bicubic interpolation
10: :param image: image to interpolate
11: :param x: x-coordinate to interpolate at
12: :param y: y-coordinate to interpolate at
13: :return: Interpolated pixel value (float)
14: """
+15: cdef int rows = image.shape[0]
__pyx_v_rows = (__pyx_v_image.shape[0]);
+16: cdef int cols = image.shape[1]
__pyx_v_cols = (__pyx_v_image.shape[1]);
17:
+18: return _c_interpolate(&image[0,0], y, x, rows, cols)
__pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_r = _c_interpolate((&(*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_image.data + __pyx_t_1 * __pyx_v_image.strides[0]) ) + __pyx_t_2 * __pyx_v_image.strides[1]) )))), __pyx_v_y, __pyx_v_x, __pyx_v_rows, __pyx_v_cols); goto __pyx_L0;
19:
20:
+21: cdef class Interpolator(InterpolatorNearestNeighbor):
struct __pyx_vtabstruct_7nanopyx_4core_9transform_22interpolation_bilinear_Interpolator {
struct __pyx_vtabstruct_7nanopyx_4core_9transform_30interpolation_nearest_neighbor_Interpolator __pyx_base;
};
static struct __pyx_vtabstruct_7nanopyx_4core_9transform_22interpolation_bilinear_Interpolator *__pyx_vtabptr_7nanopyx_4core_9transform_22interpolation_bilinear_Interpolator;
22:
+23: cdef float _interpolate(self, float x, float y) nogil:
static float __pyx_f_7nanopyx_4core_9transform_22interpolation_bilinear_12Interpolator__interpolate(struct __pyx_obj_7nanopyx_4core_9transform_22interpolation_bilinear_Interpolator *__pyx_v_self, float __pyx_v_x, float __pyx_v_y) {
float __pyx_r;
#ifdef WITH_THREAD
PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
#endif
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("_interpolate", 0);
#ifdef WITH_THREAD
__Pyx_PyGILState_Release(__pyx_gilstate_save);
#endif
/* … */
/* function exit code */
__pyx_L1_error:;
#ifdef WITH_THREAD
__pyx_gilstate_save = __Pyx_PyGILState_Ensure();
#endif
__Pyx_AddTraceback("nanopyx.core.transform.interpolation_bilinear.Interpolator._interpolate", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
#ifdef WITH_THREAD
__Pyx_PyGILState_Release(__pyx_gilstate_save);
#endif
__pyx_L0:;
__Pyx_RefNannyFinishContextNogil()
return __pyx_r;
}
+24: return _interpolate(self.image, x, y)
if (unlikely(!__pyx_v_self->__pyx_base.image.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");__PYX_ERR(1, 24, __pyx_L1_error)}
__pyx_t_1 = __pyx_f_7nanopyx_4core_9transform_22interpolation_bilinear__interpolate(__pyx_v_self->__pyx_base.image, __pyx_v_x, __pyx_v_y); if (unlikely(__pyx_t_1 == ((float)-1) && __Pyx_ErrOccurredWithGIL())) __PYX_ERR(1, 24, __pyx_L1_error)
__pyx_r = __pyx_t_1;
goto __pyx_L0;